//
//  HJPrivacyController.m
//  KaiChat
//
//  Created by lx on 2023/11/27.
//

#import "HJPrivacyController.h"
#import "HJTitleCell.h"

@interface HJPrivacyController ()

@property (nonatomic, strong) NSArray *datas;

@end

@implementation HJPrivacyController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    self.navigationBar.title = @"Privacy Security";
    [self.tableView registerClass:HJTitleCell.class forCellReuseIdentifier:@"HJTitleCell"];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.rowHeight = 50;
    self.tableView.backgroundColor = UIColor.whiteColor;
    self.tableView.showsVerticalScrollIndicator = NO;
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.top.offset(KNavBarHight);
        make.bottom.offset(0);
    }];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.datas.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    HJTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HJTitleCell" forIndexPath:indexPath];
    HJCellModel *model = self.datas[indexPath.row];
    cell.model = model;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    HJCellModel *model = self.datas[indexPath.row];
    NSString *controllerName = model.controllerName;
    if (isEmptyString(controllerName)) {
        return;
    }
    [self.navigationController pushViewControllerWithName:controllerName];
    
}

- (NSArray *)datas {
    if (!_datas) {
        _datas = @[
            [HJCellModel modelWithBlock:^(HJCellModel * _Nonnull model) {
                model.identifier = @"add";
                model.text = @"Add Method";
                model.controllerName = @"HJAddMeMethodController";
            }],
            [HJCellModel modelWithBlock:^(HJCellModel * _Nonnull model) {
                model.identifier = @"about";
                model.text = @"Blocklist";
                model.controllerName = @"HJBlacklistController";
            }],
        ];
    }
    return _datas;
}

@end
